package cn.tedu.ivos.repair.controller;

import cn.tedu.ivos.base.response.JsonResult;
import cn.tedu.ivos.repair.pojo.dto.RepairQuery;
import cn.tedu.ivos.repair.pojo.dto.RepairSaveParam;
import cn.tedu.ivos.repair.pojo.vo.RepairVO;
import cn.tedu.ivos.repair.service.RepairService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/v1/repair")
public class RepairController {
    @Autowired
    RepairService repairService;

    @RequestMapping("/save")
    public JsonResult save (RepairSaveParam repairSaveParam){
        log.debug("开始处理添加报修业务,{}",repairSaveParam);
        repairService.save(repairSaveParam);
        return JsonResult.ok();
    }
    @RequestMapping("/select")
    public JsonResult select (RepairQuery repairQuery){
        log.debug("开始处理添加报修业务");
        List<RepairVO> list=repairService.select(repairQuery);
        return JsonResult.ok(list);
    }
    @RequestMapping("/delete")
    public JsonResult delete (Long id){
        log.debug("开始处理删除报修业务");
        repairService.delete(id);
        return JsonResult.ok();
    }
}
